Skip to content

Conversation

@PaulYuuu
Copy link
Contributor

@PaulYuuu PaulYuuu commented Sep 29, 2025

  • Add comprehensive pre-commit configuration with hooks for:
    • Code quality checks (black, isort, codespell)
    • Security scanning (gitleaks)
    • File validation (large files, private keys, yaml syntax)
    • Line ending and whitespace fixes
  • Add commitlint configuration with conventional commit format
  • Configure signed-off-by trailer requirement for commits

Summary by CodeRabbit

  • Chores
    • Established pre-commit workflow with hooks for file validation, code formatting, linting, and credential scanning
    • Added commit message convention enforcement configuration

@coderabbitai
Copy link

coderabbitai bot commented Sep 29, 2025

Walkthrough

This pull request introduces two new configuration files to establish automated code quality and commit message validation workflows. The .pre-commit-config.yaml file defines a suite of pre-commit hooks spanning file validation, code formatting, linting, spell checking, and security scanning with specified versions and options. The commitlint.config.ts file configures commit message validation rules following the conventional commits standard. No existing application code is modified.

Estimated Code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Review tool versions and compatibility across hooks (gitleaks v8.28.0, isort v7.0.0, Black v25.9.0, pylint 4.0.0, codespell v2.4.1, commitlint-pre-commit-hook v9.23.0)
  • Verify hook configurations align with project requirements (file size limits, exclusion patterns, commit message rules)
  • Confirm commitlint rules enforce desired conventional commit conventions and are appropriately strict

Pre-merge checks

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: add pre-commit hooks and commitlint configuration' accurately summarizes the main changes: adding a .pre-commit-config.yaml file with multiple hooks and a commitlint.config.ts file.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8ce0939 and a16db8c.

📒 Files selected for processing (2)
  • .pre-commit-config.yaml (1 hunks)
  • commitlint.config.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • commitlint.config.ts
  • .pre-commit-config.yaml

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mr-avocado mr-avocado bot moved this to Review Requested in Default project Sep 29, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (4)
commitlint.config.mjs (2)

33-41: Avoid redundant checks: pick either signed-off-by or trailer-exists

Both rules enforce the same trailer; keeping both is redundant. Prefer a single rule (usually trailer-exists to ensure it’s in the trailer section).

     "subject-full-stop": [2, "never", "."],
-    "signed-off-by": [2, "always", "Signed-off-by:"],
+    // "signed-off-by": [2, "always", "Signed-off-by:"],
     /*
     * Enable type if we need, warn it currently.
     */
     "type-enum": [0, "always", ['ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'rfe', 'style']],
     "type-case": [0, "always", "lower-case"],
     "type-empty": [0, "never"],
     "trailer-exists": [2, "always", "Signed-off-by:"]

Reference list of supported rules includes both entries. (commitlint.js.org)


37-37: Comment says “warn it currently”, but severity is off (0)

If you want warnings (non‑blocking), set severity to 1.

-    "type-enum": [0, "always", ['ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'rfe', 'style']],
+    "type-enum": [1, "always", ['ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'rfe', 'style']],

Committed types are enforced by type-enum when enabled. (commitlint.js.org)

.pre-commit-config.yaml (2)

15-16: FYI: no-commit-to-branch already protects main and master by default

You can add more branches/patterns via args if needed; otherwise defaults are fine.

Docs for defaults and args are here. (github.com)


35-41: Optional: pin commitlint dependencies for stricter reproducibility

You already pin the hook revision. To avoid potential @commitlint/* version mismatches when adding plugins later, consider pinning versions in additional_dependencies (e.g., @commitlint/[email protected]). Not required now, just future‑proofing.

Background on dependency mismatches and rules recognition. (commitlint.js.org)

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8a2c5df and b6127c9.

📒 Files selected for processing (2)
  • .pre-commit-config.yaml (1 hunks)
  • commitlint.config.mjs (1 hunks)
🔇 Additional comments (5)
commitlint.config.mjs (3)

6-11: Config shape and ESM export look good

Using ESM with export default, extending @commitlint/config-conventional, and setting formatter: '@commitlint/format' matches current commitlint docs. (commitlint.js.org)


49-49: Do you want to enforce Signed-off-by on merge commits too?

With defaultIgnores: true, commitlint skips merge commits; that means Signed-off-by: won’t be required on merges. If you want it enforced everywhere, set defaultIgnores: false (and add custom ignores if needed).

Docs detail ignores and defaultIgnores. (commitlint.js.org)


53-55: Nice touch on helpUrl

Linking to Avocado’s commit style guide matches the local policy (72 char header, no trailing period, Signed‑off‑by).

Avocado commit style guide confirms these rules. (avocado-framework.readthedocs.io)

.pre-commit-config.yaml (2)

1-1: Correct staging setup for commitlint

Installing both pre-commit and commit-msg hook types is the recommended pattern. (github.com)


3-17: Hook versions look current

Pinned versions are recent/stable: pre-commit-hooks v6.0.0, gitleaks v8.28.0, isort 6.0.1, black 25.9.0, codespell v2.4.1, commitlint-pre-commit-hook v9.22.0.

Refs: pre-commit-hooks v6.0.0 usage; Gitleaks v8.28.0 release; isort 6.0.1; Black 25.9.0; Codespell 2.4.1; commitlint-pre-commit-hook v9.22.0. (github.com)

Copy link
Contributor

@richtja richtja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @PaulYuuu, thank you for introducing the pre-commit hooks, this will definitely be an improvement of our static-checks. I have just couple of comments:

  1. IIUIC this should replace the current static-checks scripts, therefore I would remove them from repo so we won't have two solutions.
  2. The last missing static check is lint check. Unfortunatly that is higly configurable in static-checks therefore I don't think we can use regular lint hook for it and will need to run the current script via hooks. Something like this:
- repo: local
  hooks:
    - id: check-lint
      name: Run pylint checks
      entry: static-checks/check-lint
      language: system
      types: [python]
      pass_filenames: false

args: ['--maxkb=5120']
- id: check-ast
- id: check-yaml
exclude: .cirrus.yml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .cirrus.yml is only related to avocado-vt. For example, on avocado file we need to exclude different files for example examples/yaml_to_mux/. If we won't be able to have a separated exclude list for different repos then I think we will have to remove this check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, cirrus.yml does not follow the yaml syntax, but it's vt only. So I am okay to remove it from here, if we have this requirement at specific repository, we can use another github action or static-check.

@PaulYuuu
Copy link
Contributor Author

Hi @PaulYuuu, thank you for introducing the pre-commit hooks, this will definitely be an improvement of our static-checks. I have just couple of comments:

  1. IIUIC this should replace the current static-checks scripts, therefore I would remove them from repo so we won't have two solutions.
  2. The last missing static check is lint check. Unfortunatly that is higly configurable in static-checks therefore I don't think we can use regular lint hook for it and will need to run the current script via hooks. Something like this:
- repo: local
  hooks:
    - id: check-lint
      name: Run pylint checks
      entry: static-checks/check-lint
      language: system
      types: [python]
      pass_filenames: false

Hello @richtja, I did not add pylint here is because the scope of pylint is not clear for me and I am not sure if we still need it, as we already have black and isort. I can also add pylint pre-commit hook, and for each repo, link the pylintrc from static-check submodule to the repo root, then it should works.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
commitlint.config.ts (1)

8-10: Consider removing disabled rules for clarity.

Multiple rules are explicitly disabled (level 0). If these rules are intentionally not enforced, consider removing them entirely from the configuration to reduce clutter and make the active rules more apparent. If they serve as documentation of available options, this is acceptable but may confuse contributors.

Apply this diff to remove the disabled rules:

     // Body
     'body-leading-blank': [2, 'always'],
-    'body-empty': [0, 'never'],
-    'body-min-length': [0, 'always', 1],
-    'body-case': [0, 'always', 'lower-case'],
 
     // Footer
     'footer-leading-blank': [2, 'always'],
-    'footer-empty': [0, 'never'],
-    'footer-max-length': [0, 'always', 72],
 
     // Header
-    'header-case': [0, 'always', 'lower-case'],
     'header-full-stop': [2, 'never', '.'],
     'header-max-length': [2, 'always', 72],
     'header-min-length': [2, 'always', 1],
 
     // Scope / Subject
-    'scope-case': [0, 'always', 'lower-case'],
-    'subject-case': [0, 'always', 'lower-case'],
-    'subject-empty': [0, 'never'],
     'subject-full-stop': [2, 'never', '.'],

Also applies to: 14-15, 18-18, 24-26

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b6127c9 and 141d29d.

📒 Files selected for processing (2)
  • .pre-commit-config.yaml (1 hunks)
  • commitlint.config.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-29T03:59:46.902Z
Learnt from: PaulYuuu
PR: avocado-framework/avocado-static-checks#14
File: .pre-commit-config.yaml:30-35
Timestamp: 2025-09-29T03:59:46.902Z
Learning: When .pre-commit-config.yaml is in a submodule, it's correct for it to reference files like 'spell.ignore' that will exist in the consuming repositories, not in the submodule itself.

Applied to files:

  • .pre-commit-config.yaml
🔇 Additional comments (2)
commitlint.config.ts (1)

1-36: LGTM! Configuration correctly enforces commit conventions.

The TypeScript configuration properly extends the conventional preset and enforces the key requirements mentioned in the PR objectives: signed-off-by trailer (Line 30) and conventional commit format with appropriate header constraints (Lines 19-21, 27). The structure and typing are correct, and the helpUrl appropriately points to the contributor style guide.

.pre-commit-config.yaml (1)

1-45: Comprehensive pre-commit configuration with proper commitlint integration.

The configuration provides a well-rounded set of hooks covering code quality (black, isort, pylint), security (gitleaks, detect-private-key), file validation (check-yaml, check-ast), and commit message validation (commitlint). The commitlint hook correctly references the commitlint.config.ts file and uses the appropriate commit-msg stage.

Key strengths:

  • Lines 40-45: Commitlint integration properly adds @commitlint/config-conventional dependency and will auto-discover commitlint.config.ts
  • Line 26: isort configured with black profile ensures formatter compatibility
  • Lines 7-8: Large file check with 5MB limit prevents accidental commits of binaries
  • Lines 14-15: Line ending normalization enforces LF across the codebase

Based on learnings: The spell.ignore reference (Line 39) is correct since this is a submodule configuration and the file will exist in consuming repositories.

Comment on lines 31 to 34
- repo: https://github.com/pylint-dev/pylint
rev: v4.0.0
hooks:
- id: pylint
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

Clarify pylint configuration approach for consuming repositories.

The pylint hook has no arguments or configuration specified. Based on the PR comments, you mentioned that pylint's scope is unclear and that you would link each repo's pylintrc from the static-checks submodule to the repo root. Please verify this approach will work correctly, as pylint typically requires a configuration file to function properly.

Consider one of the following approaches:

  1. Add a default pylintrc to this submodule that consuming repos can override
  2. Document in a README how consuming repos should configure their pylintrc
  3. Add args: ['--rcfile=pylintrc'] to make the expected configuration file explicit

Run this script to verify how other Python projects in the avocado-framework organization handle pylint configuration:


🏁 Script executed:

#!/bin/bash
# Search for pylint configuration files across avocado-framework repositories
gh repo list avocado-framework --limit 50 --json name,url | \
  jq -r '.[] | select(.name | startswith("avocado")) | .name' | \
  while read repo; do
    echo "=== Checking $repo ==="
    gh api "repos/avocado-framework/$repo/contents" --jq '.[] | select(.name | test("pylintrc|.pylintrc|pyproject.toml|setup.cfg")) | .name'
  done

Length of output: 398


Provide a default pylintrc and explicit rcfile arg for the pylint hook
The submodule currently lacks a pylintrc (only the main avocado repo has one), so add a pylintrc here and update the pylint hook to reference it via --rcfile. Alternatively, document in a README how consuming repos should supply or override their own pylintrc.

🤖 Prompt for AI Agents
In .pre-commit-config.yaml around lines 31 to 34, the pylint hook is referencing
the pylint repo but there is no pylintrc in this submodule; add a default
pylintrc file into the submodule (e.g., at .pylintrc) and update the pylint hook
to pass the explicit rcfile argument (--rcfile=.pylintrc) so the hook uses the
local config, or alternatively add a README entry explaining that consuming
repos must provide/override a pylintrc and modify the hook to require an
explicit path via configuration.

@richtja
Copy link
Contributor

richtja commented Oct 14, 2025

Hi @PaulYuuu, thank you for introducing the pre-commit hooks, this will definitely be an improvement of our static-checks. I have just couple of comments:

  1. IIUIC this should replace the current static-checks scripts, therefore I would remove them from repo so we won't have two solutions.
  2. The last missing static check is lint check. Unfortunatly that is higly configurable in static-checks therefore I don't think we can use regular lint hook for it and will need to run the current script via hooks. Something like this:
- repo: local
  hooks:
    - id: check-lint
      name: Run pylint checks
      entry: static-checks/check-lint
      language: system
      types: [python]
      pass_filenames: false

Hello @richtja, I did not add pylint here is because the scope of pylint is not clear for me and I am not sure if we still need it, as we already have black and isort. I can also add pylint pre-commit hook, and for each repo, link the pylintrc from static-check submodule to the repo root, then it should works.

Hi @PaulYuuu, so the pylint still makes sense in here because it adds much more checks than black or isort. Unfortunately IMO we can't use the pylint pre-commit hook directly, and we need to add the current static-checks/check-lint script into the pre-commit hooks, because in projects like Avocado or AAutils, we use different pylintrc files for different parts of each repo and the check-lint script helps us with that.

@PaulYuuu
Copy link
Contributor Author

Hi @PaulYuuu, so the pylint still makes sense in here because it adds much more checks than black or isort. Unfortunately IMO we can't use the pylint pre-commit hook directly, and we need to add the current static-checks/check-lint script into the pre-commit hooks, because in projects like Avocado or AAutils, we use different pylintrc files for different parts of each repo and the check-lint script helps us with that.

OK, thank you for the explanation, it makes senses for me as I can see aautils has the config

[lint]
autils:.pylintrc
tests:.pylintrc_tests

so I have an idea that still using the pylint hook, but we can modify the entry as pre-commit support this, like

- repo: https://github.com/pylint-dev/pylint
  rev: v4.0.0
  hooks:
    - id: pylint
      name: pylint (static-check)
      entry: static-check/check-lint
      language: bash

I will try if this can meet our requirement, but this request the avocado-static-check be a submodule should correct the name in each repo(currently aautils uses static-check, vt uses avocado-static-check), or just link the check-lint script from submodule to repo root.

@richtja
Copy link
Contributor

richtja commented Oct 14, 2025

Hi @PaulYuuu, so the pylint still makes sense in here because it adds much more checks than black or isort. Unfortunately IMO we can't use the pylint pre-commit hook directly, and we need to add the current static-checks/check-lint script into the pre-commit hooks, because in projects like Avocado or AAutils, we use different pylintrc files for different parts of each repo and the check-lint script helps us with that.

OK, thank you for the explanation, it makes senses for me as I can see aautils has the config

[lint]
autils:.pylintrc
tests:.pylintrc_tests

so I have an idea that still using the pylint hook, but we can modify the entry as pre-commit support this, like

- repo: https://github.com/pylint-dev/pylint
  rev: v4.0.0
  hooks:
    - id: pylint
      name: pylint (static-check)
      entry: static-check/check-lint
      language: bash

I will try if this can meet our requirement, but this request the avocado-static-check be a submodule should correct the name in each repo(currently aautils uses static-check, vt uses avocado-static-check), or just link the check-lint script from submodule to repo root.

I see, and I think we can update the submodule name in each repo, it shouldn't be a problem.

@PaulYuuu PaulYuuu force-pushed the pre-commit branch 4 times, most recently from d89c747 to 411d125 Compare October 16, 2025 08:30
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 50d37b0 and 411d125.

📒 Files selected for processing (2)
  • .pre-commit-config.yaml (1 hunks)
  • commitlint.config.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • commitlint.config.ts
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-29T03:59:46.902Z
Learnt from: PaulYuuu
PR: avocado-framework/avocado-static-checks#14
File: .pre-commit-config.yaml:30-35
Timestamp: 2025-09-29T03:59:46.902Z
Learning: When .pre-commit-config.yaml is in a submodule, it's correct for it to reference files like 'spell.ignore' that will exist in the consuming repositories, not in the submodule itself.

Applied to files:

  • .pre-commit-config.yaml

@PaulYuuu PaulYuuu force-pushed the pre-commit branch 3 times, most recently from 424986f to 8b79cf7 Compare October 16, 2025 08:52
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
commitlint.config.ts (1)

5-28: Remove disabled rules for clarity.

Multiple rules are explicitly set to level 0 (disabled), which adds noise without changing behavior. Commitlint best practice is to only include rules that override the preset defaults.

Consider removing the disabled rules:

   extends: ['@commitlint/config-conventional'],
   rules: {
     // Body
     'body-leading-blank': [2, 'always'],
-    'body-empty': [0, 'never'],
-    'body-min-length': [0, 'always', 1],
-    'body-case': [0, 'always', 'lower-case'],
 
     // Footer
     'footer-leading-blank': [2, 'always'],
-    'footer-empty': [0, 'never'],
-    'footer-max-length': [0, 'always', 72],
 
     // Header
-    'header-case': [0, 'always', 'lower-case'],
     'header-full-stop': [2, 'never', '.'],
     'header-max-length': [2, 'always', 72],
     'header-min-length': [2, 'always', 1],
 
     // Scope / Subject
-    'scope-case': [0, 'always', 'lower-case'],
-    'subject-case': [0, 'always', 'lower-case'],
-    'subject-empty': [0, 'never'],
     'subject-full-stop': [2, 'never', '.'],
 
     // Signed-off-by
     'signed-off-by': [2, 'always', 'Signed-off-by:'],
   },

Note: With 'subject-empty': [0, 'never'] disabled, commits without a subject line are allowed. If this is intentional, consider adding a comment explaining why subjects are optional.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 411d125 and 424986f.

📒 Files selected for processing (2)
  • .pre-commit-config.yaml (1 hunks)
  • commitlint.config.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .pre-commit-config.yaml
🔇 Additional comments (3)
commitlint.config.ts (3)

1-4: LGTM! Correct TypeScript configuration structure.

The type import and preset extension follow commitlint best practices.


20-20: Verify the header length limit is intentional.

The header-max-length is set to 72 characters, which is more restrictive than the conventional preset default of 100. Since the header includes type, scope, and subject (format: type(scope): subject), this leaves limited space for the actual subject line.

Please confirm this is the intended length limit for your project's commit messages. If 72 characters is too restrictive for practical use, consider using 100 or another value that better fits your needs.


29-36: LGTM! Signed-off-by enforcement and documentation link.

The signed-off-by rule correctly enforces the requirement mentioned in the PR objectives, and the helpUrl provides helpful documentation for contributors.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.pre-commit-config.yaml (1)

38-42: LGTM! (Optional: prefer explicit long-form argument)

The codespell configuration correctly references spell.ignore which will be present in consuming repositories. The current arg format -I=spell.ignore works, but consider the more explicit format for better readability:

Based on learnings.

     - id: codespell
-      args: ['-I=spell.ignore']
+      args: ['--ignore-words', 'spell.ignore']
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 424986f and 8b79cf7.

📒 Files selected for processing (2)
  • .pre-commit-config.yaml (1 hunks)
  • commitlint.config.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-29T03:59:46.902Z
Learnt from: PaulYuuu
PR: avocado-framework/avocado-static-checks#14
File: .pre-commit-config.yaml:30-35
Timestamp: 2025-09-29T03:59:46.902Z
Learning: When .pre-commit-config.yaml is in a submodule, it's correct for it to reference files like 'spell.ignore' that will exist in the consuming repositories, not in the submodule itself.

Applied to files:

  • .pre-commit-config.yaml
🔇 Additional comments (10)
commitlint.config.ts (3)

1-4: LGTM!

The TypeScript import and config initialization follow best practices.


5-31: LGTM!

The rules configuration properly enforces commit message standards while maintaining flexibility through selectively disabled rules. The signed-off-by requirement aligns with the PR objectives for DCO compliance.


32-36: LGTM!

The help URL provides useful guidance for contributors, and the default export is correctly formatted.

.pre-commit-config.yaml (7)

1-2: LGTM!

The default hook types and stages are correctly configured to support both pre-commit checks and commit message validation.


4-15: LGTM!

The pre-commit hooks configuration is comprehensive and follows best practices. The exclusion of Markdown and reStructuredText files from trailing whitespace checks is appropriate since these formats use trailing spaces for line breaks.


20-24: LGTM!

The isort configuration with --profile=black ensures proper compatibility between import sorting and Black formatting.


43-48: Add TypeScript dependencies for commitlint config.

The commitlint hook references commitlint.config.ts, a TypeScript configuration file that requires transpilation. The current additional_dependencies only includes @commitlint/config-conventional, missing the TypeScript runtime dependencies.

Apply this diff to add the required TypeScript dependencies:

     - id: commitlint
-      additional_dependencies: ['@commitlint/config-conventional']
+      additional_dependencies: 
+        - '@commitlint/config-conventional'
+        - 'typescript'
+        - 'ts-node'
       stages: [commit-msg]

Likely an incorrect or invalid review comment.


16-19: Gitleaks version is current. v8.28.0 is the latest release, so the pre-commit hook configuration is up-to-date and ready for deployment.


25-28: The Black version 25.9.0 is valid and is the latest release.

Black 25.9.0 was released on September 19, 2025, and is confirmed as the current latest version on PyPI. The original concern was based on information with a March 2025 knowledge cutoff, when versions in the 24.x range were current. The version numbering (25 = year 2025, 9 = September) follows Black's established convention.


29-37: Fix the pylint hook configuration incompatibility.

The current configuration combines language: python with a shell script entry (static-checks/check-lint), which is incompatible. The language: python creates a Python virtual environment and expects the entry to be a Python module or script invocable via the Python interpreter, not an arbitrary shell script.

Consider one of these solutions:

Option 1 (Recommended): Use language: system if pylint and check-lint script are available in the system PATH:

 - repo: local
   hooks:
     - id: pylint
       name: pylint
       entry: static-checks/check-lint
-      language: python
-      additional_dependencies:
-        - pylint==4.0.0
+      language: system
       pass_filenames: false
+      types: [python]

Option 2: Create a Python wrapper script that can be executed by the Python environment:

 - repo: local
   hooks:
     - id: pylint
       name: pylint
-      entry: static-checks/check-lint
+      entry: python static-checks/check-lint-wrapper.py
       language: python
       additional_dependencies:
         - pylint==4.0.0
       pass_filenames: false
+      types: [python]

Option 3: Use language: script without additional_dependencies (requires pylint pre-installed):

 - repo: local
   hooks:
     - id: pylint
       name: pylint
       entry: static-checks/check-lint
-      language: python
-      additional_dependencies:
-        - pylint==4.0.0
+      language: script
       pass_filenames: false
+      types: [python]

Likely an incorrect or invalid review comment.

@PaulYuuu PaulYuuu force-pushed the pre-commit branch 2 times, most recently from 325bd7a to 8ce0939 Compare October 16, 2025 09:46
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
.pre-commit-config.yaml (1)

38-44: Consider using the long-form argument for codespell.

The short form -I=spell.ignore works correctly, but the long form --ignore-words is more explicit and self-documenting.

Apply this diff if you prefer the long form:

     - id: codespell
-      args: ['-I=spell.ignore']
+      args: ['--ignore-words', 'spell.ignore']
       exclude: 'static-checks/.*'

Note: Based on learnings, the spell.ignore file will exist in consuming repositories, not in this submodule, which is the correct pattern for shared pre-commit configurations.

Based on learnings

check-lint (1)

89-93: Skipping pylint when config is missing is intentional
Most avocado-framework repos don’t include avocado-static-checks.conf, so exiting 0 avoids lint failures in submodules.
Optional: document this in your README or add an env var (e.g. FAIL_ON_MISSING_CONFIG) to enforce a missing-config error.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 325bd7a and 8ce0939.

📒 Files selected for processing (3)
  • .pre-commit-config.yaml (1 hunks)
  • check-lint (1 hunks)
  • commitlint.config.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • commitlint.config.ts
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-29T03:59:46.902Z
Learnt from: PaulYuuu
PR: avocado-framework/avocado-static-checks#14
File: .pre-commit-config.yaml:30-35
Timestamp: 2025-09-29T03:59:46.902Z
Learning: When .pre-commit-config.yaml is in a submodule, it's correct for it to reference files like 'spell.ignore' that will exist in the consuming repositories, not in the submodule itself.

Applied to files:

  • .pre-commit-config.yaml
🔇 Additional comments (1)
.pre-commit-config.yaml (1)

44-49: LGTM! Commitlint configuration is correct.

The commitlint hook is properly configured with:

  • The conventional config as an additional dependency
  • Correct stage override to commit-msg (different from the default pre-commit)
  • Appropriate version of the hook

This aligns well with the new commitlint.config.ts file mentioned in the PR objectives.

@PaulYuuu
Copy link
Contributor Author

Changes:

  • Add a new local hook with pylint installed in venv, to integrate with check-lint
  • Modify check-lint, exit when no config file given rather than use default config file

avocado-vt does not use check-lint, even if we can skip the check via SKIP=pylint env variable in the CI env, but for user, they also have to do this, change the behavior of the script for more user friendly.

@PaulYuuu PaulYuuu requested a review from richtja October 16, 2025 10:07
@PaulYuuu
Copy link
Contributor Author

@PaulYuuu
Copy link
Contributor Author

Hello @clebergnu @richtja, any concerns of the latest changes?

richtja added a commit to richtja/avocado-vt that referenced this pull request Nov 3, 2025
This commit centralizes the static checks configuration:

- Add .pylintrc with disabled pylint messages and excluded directories
  from the inspekt lint command (W, R, C, and specific error codes).
  Also excludes avocado-libs and scripts/github directories.

- Add avocado-static-checks.conf to configure the static checks system

- Simplify Makefile check target to use a single run-static-checks
  script instead of multiple individual check commands

- Replace inspekt lint usage: inspekt is outdated and no longer in
  active development, so the configuration has been migrated to use
  pylint directly via .pylintrc

This refactoring makes the static checks configuration more maintainable
and easier to update in a single location.

Assisted-by: Cursor
Reference:
avocado-framework/avocado-static-checks#14
Signed-off-by: Jan Richter <[email protected]>
richtja added a commit to richtja/avocado-vt that referenced this pull request Nov 3, 2025
This commit centralizes the static checks configuration:

- Add .pylintrc with disabled pylint messages and excluded directories
  from the inspekt lint command (W, R, C, and specific error codes).
  Also excludes avocado-libs and scripts/github directories.

- Add avocado-static-checks.conf to configure the static checks system

- Simplify Makefile check target to use a single run-static-checks
  script instead of multiple individual check commands

- Replace inspekt lint usage: inspekt is outdated and no longer in
  active development, so the configuration has been migrated to use
  pylint directly via .pylintrc

This refactoring makes the static checks configuration more maintainable
and easier to update in a single location.

Assisted-by: Cursor
Reference:
avocado-framework/avocado-static-checks#14
Signed-off-by: Jan Richter <[email protected]>
richtja added a commit to richtja/avocado-vt that referenced this pull request Nov 4, 2025
This commit centralizes the static checks configuration:

- Add .pylintrc with disabled pylint messages and excluded directories
  from the inspekt lint command (W, R, C, and specific error codes).
  Also excludes avocado-libs and scripts/github directories.

- Add avocado-static-checks.conf to configure the static checks system

- Simplify Makefile check target to use a single run-static-checks
  script instead of multiple individual check commands

- Replace inspekt lint usage: inspekt is outdated and no longer in
  active development, so the configuration has been migrated to use
  pylint directly via .pylintrc

This refactoring makes the static checks configuration more maintainable
and easier to update in a single location.

Assisted-by: Cursor
Reference:
avocado-framework/avocado-static-checks#14
Signed-off-by: Jan Richter <[email protected]>
richtja added a commit to richtja/avocado-vt that referenced this pull request Nov 4, 2025
This commit centralizes the static checks configuration:

- Add .pylintrc with disabled pylint messages and excluded directories
  from the inspekt lint command (W, R, C, and specific error codes).
  Also excludes avocado-libs and scripts/github directories.

- Add avocado-static-checks.conf to configure the static checks system

- Simplify Makefile check target to use a single run-static-checks
  script instead of multiple individual check commands

- Replace inspekt lint usage: inspekt is outdated and no longer in
  active development, so the configuration has been migrated to use
  pylint directly via .pylintrc

This refactoring makes the static checks configuration more maintainable
and easier to update in a single location.

Assisted-by: Cursor
Reference:
avocado-framework/avocado-static-checks#14
Signed-off-by: Jan Richter <[email protected]>
Copy link
Contributor

@richtja richtja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @PaulYuuu, thank you for the update, most of your changes LGTM. I would just remove the skip option for lint checks.

You are right that currently avocado-vt uses pylint through inspektor, but IMO the inspektor is quite outdated without any development for many years. Therefore, I introduced avocado-framework/avocado-vt#4260. Which will move avocado-vt from inspektor to static-cheks. Let me know what do you think?

@PaulYuuu
Copy link
Contributor Author

PaulYuuu commented Nov 5, 2025

Hi @PaulYuuu, thank you for the update, most of your changes LGTM. I would just remove the skip option for lint checks.

You are right that currently avocado-vt uses pylint through inspektor, but IMO the inspektor is quite outdated without any development for many years. Therefore, I introduced avocado-framework/avocado-vt#4260. Which will move avocado-vt from inspektor to static-cheks. Let me know what do you think?

I am okay with keeping the pylint check. For VT, it should also migrate to pylint indeed. FYI, tp-qemu migrated from inspektor to ruff, but in this PR, let me respect the design of avocado-framework.

- Add comprehensive pre-commit configuration with hooks for:
  - Code quality checks (black, isort, pylint, codespell)
  - Security scanning (gitleaks)
  - Line ending and whitespace fixes
- Add commitlint configuration with conventional commit format
- Configure signed-off-by trailer requirement for commits

Signed-off-by: Yihuang Yu <[email protected]>
Copy link
Contributor

@richtja richtja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @PaulYuuu, thanks for the updates it LGTM.

@richtja richtja merged commit 60820c9 into avocado-framework:main Nov 5, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from Review Requested to Done 113 in Default project Nov 5, 2025
richtja added a commit to richtja/avocado that referenced this pull request Nov 5, 2025
This commit introduces the latest changes in avocado-static-checks repo,
which uses pre-commit hooks instead of current scripts solution.

Reference:
avocado-framework/avocado-static-checks#14
Signed-off-by: Jan Richter <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done 113

Development

Successfully merging this pull request may close these issues.

2 participants